<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">阿里云MQ</h1>
                    <small class="text-muted">配置管理</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->

            <uib-tabset>
                <uib-tab index="0" heading="Topic管理">
                    <div class="panel panel-default" ng-controller="aliyunMqMgmtCtrl">
                        <div class="panel-body">

                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    <div class="input-group">
                                        <span class="input-group-addon">精确查询Topic名称</span>
                                        <input type="text" class="form-control" ng-model="topicQueryName"
                                               placeholder="名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <button type="button" class="btn btn-info" ng-click="queryTopic()"><span
                                            class="glyphicon glyphicon-search"></span>搜索
                                    </button>
                                    <button type="button" class="btn btn-info" ng-click="reSet()"><span
                                            class="glyphicon glyphicon-repeat"></span>重置
                                    </button>
                                    <button ng-if="contains(authPoint, '/aliyun/mq/save')"
                                            type="button" class="btn btn-success" ng-click="createTopic()"><span
                                            class="glyphicon glyphicon-plus"></span>新建Topic
                                    </button>
                                </div>
                            </form>

                            <div class="panel panel-default" style="margin-top: 5px;;">
                                <div class="panel-body">
                                    <div>
                                        <table class="table table-hover table-bordered table-striped">
                                            <thead>
                                            <tr>
                                                <td>Topic</td>
                                                <td>消息类型</td>
                                                <td>创建人(oc平台创建才会记录)</td>
                                                <td>修改时间</td>
                                                <td ng-if="contains(authPoint, '/server/save')">操作</td>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr ng-repeat="topic in topicList">
                                                <td>
                                                    <b style="color: #286090">{{topic.topic}}</b>
                                                    </br>
                                                    <b style="color: #777">{{topic.remark}}</b>
                                                </td>
                                                <td>
                                                    <b style="color: #20a03f"
                                                       ng-if="topic.messageType == 0">普通消息</b>
                                                    <b style="color: #2ea8e5"
                                                       ng-if="topic.messageType == 1">分区顺序消息</b>
                                                    <b style="color: #2ea8e5"
                                                       ng-if="topic.messageType == 2">全局顺序消息</b>
                                                    <b style="color: #ff5f87"
                                                       ng-if="topic.messageType == 4">事务消息</b>
                                                    <b style="color: #990000"
                                                       ng-if="topic.messageType == 5">定时/延时消息</b>
                                                </td>
                                                <td>{{topic.displayName}}</td>
                                                <td>{{(topic.gmtModify == null || topic.gmtModify == '') ?
                                                    topic.gmtCreate
                                                    : topic.gmtModify}}
                                                </td>
                                                <td ng-if="contains(authPoint, '/server/save')">
                                                    <button ng-click="editServer(item)"
                                                            class="btn btn-xs"
                                                            style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                        <span class="glyphicon glyphicon-edit"></span>编辑
                                                    </button>

                                                    <button ng-click="delServer(item)"
                                                            class="btn btn-xs pull-right"
                                                            style="background-color: red; color: white;">
                                                        <span class="glyphicon glyphicon-remove"></span>删除
                                                    </button>

                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </uib-tab>

                <uib-tab index="1" heading="订阅信息管理">
                    <div class="panel panel-default" ng-controller="aliyunMqMgmtCtrl">
                        <div class="panel-body">

                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    <button type="button" class="btn btn-info" ng-click="queryGroup()">
                                        <i class="fa fa-spin fa-spinner" ng-show="butSearchSubscribe"></i>
                                        <i class="glyphicon glyphicon-search" ng-show="!butSearchSubscribe"></i>搜索
                                    </button>
                                    <button ng-if="contains(authPoint, '/aliyun/mq/save')"
                                            type="button" class="btn btn-success" ng-click="createGroup()"><span
                                            class="glyphicon glyphicon-plus"></span>新建消费者
                                    </button>
                                </div>
                            </form>

                            <div class="panel panel-default" style="margin-top: 5px;;">
                                <div class="panel-body">
                                    <div>
                                        <table class="table table-hover table-bordered table-striped">
                                            <thead>
                                            <tr>
                                                <td>GID</td>
                                                <td>状态</td>
                                                <td>消息堆积</td>
                                                <td>告警通知</td>
                                                <td>创建人</td>
                                                <td>接收人</td>
                                                <td>修改时间</td>
                                                <td ng-if="contains(authPoint, '/aliyun/mq/save')">操作</td>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr ng-repeat="subscribe in subscribeList">
                                                <td>
                                                    <b style="color: #286090">{{subscribe.groupId}}</b>
                                                    </br>
                                                    <b style="color: #777">{{subscribe.remark}}</b>
                                                </td>
                                                <td>
                                                    <b style="color: #20a03f" ng-if="subscribe.status == 0">{{subscribe.statusName}}</b>
                                                    <b style="color: #990000" ng-if="subscribe.status != 0">{{subscribe.statusName}}</b>
                                                </td>
                                                <td>
                                                    <!--<uib-progressbar max="10000" value="subscribe.lastTotalDiff" style="background-color: #d0d0d0" type="warning">-->
                                                        <!--<b style="color: white; white-space:nowrap;">{{subscribe.lastTotalDiff}}</b></uib-progressbar>-->
                                                    <uib-progress max="subscribe.uibProgressbarMax" style="background-color: #d0d0d0">
                                                        <uib-bar  value="subscribe.lastTotalDiff" style="background-color: #2ea8e5">
                                                            <b style="color: white; white-space:nowrap;">{{subscribe.lastTotalDiff}}</b></uib-bar>
                                                    </uib-progress>

                                                </td>
                                                <td>
                                                    <b style="color: #20a03f" ng-if="subscribe.notice">是</b>
                                                    <b style="color: #990000" ng-if="!subscribe.notice">否</b>
                                                </td>
                                                <td>{{subscribe.displayName}}</td>
                                                <td>
                                                    <div ng-repeat="user in subscribe.userList">
                                                        <b style="color: #286090">{{user.userVO.username}}<{{user.userVO.displayName}}></b>
                                                    </div>
                                                </td>
                                                <td>{{(subscribe.gmtModify == null || subscribe.gmtModify == '') ?
                                                    subscribe.gmtCreate : subscribe.gmtModify}}
                                                </td>
                                                <td ng-if="contains(authPoint, '/aliyun/mq/save')">
                                                    <button ng-click="editGroup(subscribe)"
                                                            class="btn btn-xs"
                                                            style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                        <span class="glyphicon glyphicon-edit"></span>配置
                                                    </button>

                                                    <button ng-click="editGroupUser(subscribe)"
                                                            class="btn btn-xs"
                                                            style="margin-left: 5px; background-color: #ff8700; color: white;">
                                                        <span class="icon icon-users"></span>接收人
                                                    </button>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </uib-tab>
            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>

<!--新建Topic-->
<script type="text/ng-template" id="createTopicModal">
    <div ng-include="'tpl/modal/mq/create_topic_modal.html'"></div>
</script>

<!--新建Group-->
<script type="text/ng-template" id="createGroupModal">
    <div ng-include="'tpl/modal/mq/create_group_modal.html'"></div>
</script>

<!--配置Group-->
<script type="text/ng-template" id="editGroupModal">
    <div ng-include="'tpl/modal/mq/edit_group_modal.html'"></div>
</script>

<!--配置Group告警接收人-->
<script type="text/ng-template" id="editGroupUserModal">
    <div ng-include="'tpl/modal/mq/edit_group_user_modal.html'"></div>
</script>